import { defineStore } from 'pinia'

export const wirelessManageStore = defineStore('wirelessManage', {
  state () {
    return {
      chooseWorkDayStr: '',
      chooseWorkDayList: [],
      baseTimingData: null,
      // 无线管理定时情景
      timedScenarioObj: null,
      // 选中的标签
      operateItem: null,
      // 标签对象
      operateInfoObj: null,
      // 标签数组
      operateObjList: [],
      // 设备设置
      deviceSetList: [],
      // 网关列表
      gatewayList: [],
      // 设备区域列表
      deviceAreaList: [],
      // 设备组列表
      deviceGroupList: [],
      // 设备号列表
      deviceNumberList: [],
      treeProject: {},
      treeGateway: {}
    }
  },
  actions: {
    setDeviceNumberList (list) {
      this.deviceNumberList = list
    },
    setDeviceGroupList (list) {
      this.deviceGroupList = list
    },
    setDeviceAreaList (list) {
      this.deviceAreaList = list
    },
    setGatewayList (list) {
      this.gatewayList = list
    },
    setDeviceSetList (list) {
      this.deviceSetList = list
    },
    setChooseWorkDayStr (val) {
      this.chooseWorkDayStr = JSON.parse(JSON.stringify(val))
    },
    setChooseWorkDayList (val) {
      this.chooseWorkDayList = JSON.parse(JSON.stringify(val))
    },
    setBasicTimingData (obj) {
      this.baseTimingData = obj
    },
    setTimedScenarioList (data) {
      this.timedScenarioObj = data
      this.setOperateNewList(data.records)
    },
    setOperateItem (row) {
      this.operateItem = row
    },
    setOperateObjItem (obj) {
      this.operateInfoObj = obj
    },
    setOperateNewList (list) {
      this.operateObjList = list
    },
    setTreeProject (pro) {
      console.log('setTreeProject', pro);
      this.treeProject = pro
    },
    setTreeGateway (obj) {
      console.log('setTreeGateway', obj);
      this.treeGateway = obj
    }
  },
  getters: {}
})